#ifndef CFG_H
#define CFG_H

#ifndef STRICT
#define STRICT
#endif

#include "tregist.h"
#include "THosts.h"
#include "TLIST.h"
#include "common_include.h"
#include "TBroadcastList.h"

struct Cfg {
protected:
	BOOL	ReadFontRegistry(TRegistry *reg, char *key, LOGFONT *font);
	BOOL	WriteFontRegistry(TRegistry *reg, char *key, LOGFONT *font);

public:
	THosts	priorityHosts;
	THosts	fileHosts;
	int		PriorityMax;
	int		PriorityReject;
	char	**PrioritySound;

	ULONG	nicAddr;
	int		portNo;
	BOOL	NoPopupCheck;
	BOOL	OpenCheck;
	BOOL	NoErase;
	BOOL	NoBeep;
	BOOL	OneClickPopup;
	int		DelayTime;
	BOOL	LogCheck;
	char	LogFile[MAX_PATH];
	char	SoundFile[MAX_PATH];
	BOOL	AbsenceSave;
	BOOL	AbsenceCheck;
	int		AbsenceMax;
	int		AbsenceChoice;
	char	(*AbsenceStr)[MAX_PATH];
	char	(*AbsenceHead)[MAX_NAMEBUF];

	int		FindMax;
	char	(*FindStr)[MAX_NAMEBUF];
	BOOL	FindAll;

	HCRYPTPROV	hSmallCsp;
	PubKey		smallPubKey;
	HCRYPTKEY	hSmallPrivKey;

	HCRYPTPROV	hCsp;
	PubKey		pubKey;
	BYTE		*privBlob;
	int			privBlobLen;
	int			privEncryptType;
	BYTE		*privEncryptSeed;
	int			privEncryptSeedLen;
	HCRYPTKEY	hPrivKey;
	
	BOOL	QuoteCheck;
	BOOL	SecretCheck;
	BOOL	IPAddrCheck;
	BOOL	HotKeyCheck;
	int		HotKeyModify;
	int		HotKeySend;
	int		HotKeyRecv;
	int		HotKeyMisc;
	BOOL	ControlIME;
	int		GlidLineCheck;
	UINT	ColumnItems;
	BOOL	AllowSendList;
	int		fileTransOpt;
	int		ResolveOpt;
	int		EncryptNum;

	int		ViewMax;
	int		TransMax;
	int		TcpbufMax;

	int		NickNameCheck;
	char	NickNameStr[MAX_NAMEBUF];
	char	GroupNameStr[MAX_NAMEBUF];
	BOOL	AbnormalButton;
	BOOL	AbsenceNonPopup;
	BOOL	ListGet;
	UINT	ListGetMSec;
	UINT	RetryMSec;
	UINT	RetryMax;
	int		RecvMax;
	char	Lang[MAX_LANGBUF];
	char	IconFile[MAX_PATH];
	char	RevIconFile[MAX_PATH];
	char	lastSaveDir[MAX_PATH];
	char	lastOpenDir[MAX_PATH];
	ULONG	Sort;
	int		UpdateTime;
	int		KeepHostTime;
	BOOL	MsgMinimize;
	BOOL	DefaultUrl;
	BOOL	ShellExec;
	BOOL	ExtendEntry;
	char	QuoteStr[MAX_NAMEBUF];
	BOOL	Debug;

	int		SendWidth[MAX_SENDWIDTH];
	int		SendOrder[MAX_SENDWIDTH];

	int		SendXdiff;
	int		SendYdiff;
	int		SendMidYdiff;
	BOOL	SendSavePos;
	int		SendXpos;
	int		SendYpos;

	int		RecvXdiff;
	int		RecvYdiff;
	BOOL	RecvSavePos;
	int		RecvXpos;
	int		RecvYpos;

	LOGFONT	SendEditFont;
	LOGFONT	SendListFont;
	LOGFONT	RecvHeadFont;
	LOGFONT	RecvEditFont;

	char	PasswordStr[MAX_NAMEBUF];
	BOOL	PasswdLogCheck;
	TList	urlList;
	BOOL	DialUpCheck;
	TList	DialUpList;
	TBroadcastList	broadcastList;

	Cfg(ULONG _nicAddr, int _portNo);
	~Cfg();
	enum PART { FIND };

	BOOL	ReadRegistry(void);
	BOOL	WriteRegistry(int ctl_flg = CFG_ALL);
	void	GetRegName(char *buf, ULONG nic_addr, int port_no);
};

#endif